/*
 * @Description: 将顶部 页面主体 底部整合为主页
 * @Author: YWJ 
 * @Date: 2022-04-20 19:05:26 
 * @Last Modified by: YWJ
 * @Last Modified time: 2022-04-20 19:11:15
 */

<template>
  <div id="home">
    <el-container>

    	<base-header :activeIndex="activeIndex"></base-header>

		  <router-view class="me-container"/>

		<base-footer v-show="footerShow"></base-footer>

	  </el-container>

  </div>

</template>

<script>
import BaseFooter from '@/components/common/BaseFooter.vue'
import BaseHeader from '@/components/common/BaseHeader.vue'

export default {
  name: 'Home',
  data (){
  	return {
  			activeIndex: '/',
  			footerShow:true
  	}
  },
  components:{
  	'base-header':BaseHeader,
  	'base-footer':BaseFooter
  },
  //顶部导航栏切换时所选栏目下标传值
  beforeRouteEnter (to, from, next){
  	 next(vm => {
    	vm.activeIndex = to.path
  	})
  },
  //在首页则显示底部 不在首页则不显示
  beforeRouteUpdate (to, from, next) {
	  if(to.path == '/'){
	  	this.footerShow = true
	  }else{
	  	this.footerShow = false
	  }
	  this.activeIndex = to.path
	  next()
	}
}
</script>

<style>

.me-container{
  margin: 100px auto 140px;
}
</style>